<template>
	<view class="nav-bar-box" :style="{height: height + 'px'}">
		<view class="nav-bar" :style="{height: height + 'px'}">
			<view class="nav-back" :style="{'top': backTop + 'px'}" @tap="navBack">
				<image src="../static/images/back.png"></image>
			</view>
			<view class="nav-title" :style="{'top': titleTop + 'px'}">
				<view class="nav-title-text">{{title}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: ['title'],
		
		data() {
			return {
				height: 0,
				backTop: 0,
				titleTop: 0
			}
		},
		
		mounted() {
			let sysInfo = uni.getSystemInfoSync()
			this.height = sysInfo.statusBarHeight + 50
			this.backTop = sysInfo.statusBarHeight - 12
			this.titleTop = sysInfo.statusBarHeight - 16
		},
		
		methods: {
			
			navBack() {
				uni.navigateBack()
			}
			
		}
	}
</script>

<style>
	.nav-bar-box {
		width: 750rpx;
		position: relative;
		background-color: #ffffff;
		z-index: 999998;
	}
	
	.nav-bar {
		width: 750rpx;
		display: flex;
		flex-direction: row;
		align-items: center;
		position: fixed;
		z-index: 999999;
		background-color: #ffffff;
	}
	
	.nav-back {
		width: 40rpx;
		margin-left: 42rpx;
		position: relative;
	}
	
	.nav-back image {
		width: 18rpx;
		height: 32rpx;
	}
	
	.nav-title {
		width: 668rpx;
		color: #333333;
		font-size: 36rpx;
		display: flex;
		flex-direction: row;
		justify-content: center;
		position: relative;
	}
	
	.nav-title-text {
		margin-right: 76rpx;
	}
</style>
